<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>设备检修</title>
		<link rel="stylesheet" href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
iframe {
	width: 100%;
	height: 600px;
}

.ui-datalist-empty-message {
	min-height: 100px;
}

.ui-datalist-content {
	min-height: 100px;
}

.purple {
	background-color: #ef8519;
}

.green {
	background-color: #4cb9da;
}

.red {
	background-color: #57ce49;
}

.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<p:growl id="msgs" showDetail="true" />
				<div class="box box-solid with-border">
					<div id="queryDiv" class="box-header">
						<p:outputLabel for="popup1" value="申请开始时间：" />
						<p:calendar id="popup1" navigator="true"
							value="#{equipmentOverhualDetailController.queryDate1}" pattern="yyyy-MM-dd" maxdate="Date()"
							size="14" />
						<p:outputLabel for="popup2" value="至 " />
						<p:calendar id="popup2" navigator="true"
							value="#{equipmentOverhualDetailController.queryDate2}" pattern="yyyy-MM-dd" maxdate="Date()"
							size="14" />
						<p:outputLabel for="popup3" value="批准开始时间：" style="margin-left:10px;" />
						<p:calendar id="popup3" navigator="true"
							value="#{equipmentOverhualDetailController.queryDate3}" pattern="yyyy-MM-dd" maxdate="Date()"
							size="14" />
						<p:outputLabel for="popup4" value="至 " />
						<p:calendar id="popup4" navigator="true"
							value="#{equipmentOverhualDetailController.queryDate4}" pattern="yyyy-MM-dd" maxdate="Date()"
							size="14" locale="zh" />
						<p:commandButton value="查询" oncomplete="getTableScrollHeight();"
							style="marin-right:10px;margin-left:10px;"
							action="#{equipmentOverhualDetailController.initTable()}" icon="ui-icon-search"
							update=" form:dataTb headForm:toolbar_overhual headForm:msgs">
						</p:commandButton>
						<p:commandButton icon="ui-icon-refresh" value="重置"
							actionListener="#{equipmentOverhualDetailController.resetQuery}" style="margin-left:5px;"
							oncomplete="getTableScrollHeight();"
							update="toolbar_overhual popup1 popup2 popup3 popup4 form:dataTb  workPlace  overhual" />
					   <div class="box-tools pull-right">
						<button type="button" id="selectButton" title="高级查询" class="btn btn-default"
								onclick="onSelectDivClick();" style="margin-right: 50px;">
							<span id="selectButtonIcon" class="fa fa-caret-down">高级查询</span>
						</button>
					   </div>
					</div>
					<div class="panel-collapse collapse" id="selectDiv">
						<p:outputLabel value="工作地点：" style="margin-left:10px;" />
						<p:inputText id="workPlace" value="#{equipmentOverhualDetailController.workPlace}"></p:inputText>
						<p:outputLabel value="检修内容：" style="margin-left:10px;" />
						<p:inputText id="overhual" value="#{equipmentOverhualDetailController.overhualContent}"></p:inputText>
					</div>
				</div>
				<div id="toolbarDiv">
					<p:toolbar id="toolbar_overhual">
						<f:facet name="left">
							<p:commandButton value="新建" icon="fa fa-plus" oncomplete="PF('createDlg').show()"
								actionListener="#{equipmentOverhualDetailController.preCreate()}"
								update="editForm:createDlg " rendered="#{s:hasPermission(session,'bhyx_sbjxxq_xj')}" />
							<p:commandButton value="编辑" id="editbtn1" icon="fa fa-pencil"
								oncomplete="PF('createDlg').show()"
								actionListener="#{equipmentOverhualDetailController.preUpate()}"
								update="editForm:createDlg "
								disabled="#{equipmentOverhualDetailController.selectOverhaul==null}"
								rendered="#{s:hasPermission(session,'bhyx_sbjxxq_bj')}" />
							<p:commandButton value="删除" id="delbtn1" icon="fa fa-trash"
								update="form:dataTb headForm:toolbar_overhual  headForm:msgs"
								actionListener="#{equipmentOverhualDetailController.delete()}"
								disabled="#{equipmentOverhualDetailController.selectOverhaul==null}"
								rendered="#{s:hasPermission(session,'bhyx_sbjxxq_sc')}" oncomplete="getTableScrollHeight();">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:dataTable var="item" id="dataTb" value="#{equipmentOverhualDetailController.model}"
					rowKey="#{item.id}" emptyMessage="无记录" lazy="true" paginator="true" paginatorPosition="bottom"
					paginatorTemplate=" {Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rows="20" rowsPerPageTemplate="20,50,100" scrollable="true">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{equipmentOverhualDetailController.recordSize} 条记录"
							style="margin-right:20px;"></p:outputLabel>
					</f:facet>
					<p:ajax event="rowSelectRadio" update="headForm:toolbar_overhual"
						listener="#{equipmentOverhualDetailController.onRowSelect}" />
					<p:column selectionMode="single" width="2%" style="text-align:center" />
					<p:column headerText="序号" width="3%">
						<h:outputText value="#{equipmentOverhualDetailController.getIndex(item)}" />
					</p:column>
					<p:column width="9%" headerText="申请单编号">
						<h:outputText value="#{item.applicationNumber}" />
					</p:column>
					<p:column width="7%" headerText="申请单位">
						<h:outputText value="#{item.applicationUnit}" />
					</p:column>
					<p:column width="7%" headerText="工作地点">
						<h:outputText value="#{item.workingPlace}" />
					</p:column>
					<p:column width="5%" headerText="检修类别">
						<h:outputText value="#{item.overhaulType}" />
					</p:column>
					<p:column width="40%" headerText="检修内容">
						<h:outputText value="#{item.overhaulContent}" />
					</p:column>
					<p:column width="7%" headerText="执行单位">
						<h:outputText value="#{item.executableUnit}" />
					</p:column>
					<p:column width="10%" headerText="批准停电操作开始时间">
						<h:outputText value="#{item.batchPowerStartTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="GMT+8" />
						</h:outputText>
					</p:column>
					<p:column width="10%" headerText="批准复电操作结束时间">
						<h:outputText value="#{item.batchPowerEndtTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="GMT+8" />
						</h:outputText>
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="editForm">
				<p:dialog widgetVar="createDlg"
					header="#{equipmentOverhualDetailController.current.id==null?'新建':'编辑'}" modal="true"
					id="createDlg" width="1300" height="600">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton id="createSaveBtn" value="保存" style="float: right;" icon="fa fa-floppy-o"
								update="form:dataTb headForm:msgs"
								actionListener="#{equipmentOverhualDetailController.save()}"
								oncomplete="PF('createDlg').hide();getTableScrollHeight();" />
						</f:facet>
					</p:toolbar>
					<p:panelGrid style="width:100%;">
						<p:row>
							<p:column>
								<h:outputText value="申请单编号" />
							</p:column>
							<p:column>
								<p:inputText value="#{equipmentOverhualDetailController.current.applicationNumber}" />
							</p:column>
							<p:column>
								<h:outputText value="批复编号" />
							</p:column>
							<p:column>
								<p:inputText value="#{equipmentOverhualDetailController.current.batchNumber}" />
							</p:column>
							<p:column>
								<h:outputText value="申请单位" />
							</p:column>
							<p:column>
								<p:autoComplete value="#{equipmentOverhualDetailController.current.applicationUnit}"
									completeMethod="#{equipmentOverhualDetailController.completeAppUnit}" dropdown="true"
									scrollHeight="400" />
							</p:column>
							<p:column>
								<h:outputText value="工作地点" />
							</p:column>
							<p:column>
								<p:autoComplete value="#{equipmentOverhualDetailController.current.workingPlace}"
									completeMethod="#{cimUtilController.completeCimStation500}" dropdown="true" scrollHeight="400">
									<p:ajax event="itemSelect" listener="#{equipmentOverhualDetailController.handleSelect}" />
								</p:autoComplete>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="批准停电操作开始时间" />
							</p:column>
							<p:column>
								<p:calendar navigator="true" pattern="yyyy-MM-dd HH:mm:ss"
									value="#{equipmentOverhualDetailController.current.batchPowerStartTime}" />
							</p:column>
							<p:column>
								<h:outputText value="批准复电操作结束时间" />
							</p:column>
							<p:column>
								<p:calendar navigator="true" pattern="yyyy-MM-dd HH:mm:ss"
									value="#{equipmentOverhualDetailController.current.batchPowerEndtTime}" />
							</p:column>
							<p:column>
								<h:outputText value="申请停电操作开始时间" />
							</p:column>
							<p:column>
								<p:calendar navigator="true" pattern="yyyy-MM-dd HH:mm:ss"
									value="#{equipmentOverhualDetailController.current.applicationPowerStartTime}" />
							</p:column>
							<p:column>
								<h:outputText value="申请复电操作结束时间" />
							</p:column>
							<p:column>
								<p:calendar navigator="true" pattern="yyyy-MM-dd HH:mm:ss"
									value="#{equipmentOverhualDetailController.current.applicationPowerEndTime}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="检修类别" />
							</p:column>
							<p:column>
								<p:inputText value="#{equipmentOverhualDetailController.current.overhaulType}" />
							</p:column>
							<p:column>
								<h:outputText value="检修单执行方" />
							</p:column>
							<p:column>
								<p:inputText value="#{equipmentOverhualDetailController.current.executableUnit}" />
							</p:column>
							<p:column>
								<h:outputText value="其它要求" />
							</p:column>
							<p:column colspan="3">
								<p:inputText value="#{equipmentOverhualDetailController.current.otherRequirements}"
									style="width:100%;" />
							</p:column>

						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="一次设备状态" />
							</p:column>
							<p:column colspan="7">
								<h:inputTextarea rows="4" style="width:100%"
									value="#{equipmentOverhualDetailController.current.primaryEquipmentStatus}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="二次设备状态" />
							</p:column>
							<p:column colspan="7">
								<h:inputTextarea rows="4" style="width:100%"
									value="#{equipmentOverhualDetailController.current.secondaryEquipmentStatus}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="检修内容" />
							</p:column>
							<p:column colspan="7">
								<h:inputTextarea rows="6" style="width:100%"
									value="#{equipmentOverhualDetailController.current.overhaulContent}" />
							</p:column>
						</p:row>
					</p:panelGrid>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>